import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class demo39 {
    public static void main(String[] args) throws InterruptedException {
        ExecutorService executorService= Executors.newCachedThreadPool();
        for(int i=0;i<1000;i++){
            int id=i;
            //提交任务
            executorService.submit(()->{
                System.out.println("hello"+id+","+Thread.currentThread().getName());
            });
        }
//        executorService.shutdown();
        executorService.awaitTermination(1, TimeUnit.MINUTES);


    }
}
